<%@ page  contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8" />
<title>定制洗衣</title>
<style type="text/css">
* {
	margin: 0px;
	padding: 0px;
}

#top {
	position: fixed;
	left: 0;
	top: 0;
	width: 100%;
	height: 80px;
	background: #fff;
	z-index: 9999999;
	border-top: 4px solid #299FFF;
	border-bottom: 1px solid #eeeeee;
}


#top ul li {
	float: left;
	margin-left: 180px;
	line-height: 80px;
	text-align: center;
	font-size: 20px;
}
#footer ul li {
	float: left;
	margin-left: 240px;
	line-height: 80px;
	text-align: center;
	font-size: 20px;
}

a {
	text-decoration: none;
	cursor: pointer;
}

a:hover {
	text-decoration: none;
}

#middle {
	margin-top: 10px;
}

#top ul li a {
	text-decoration: none;
}

#top ul li a:hover {
	color: blue;
}

#footer ul li a {
	text-decoration: none;
}
#footer{
}
#footer ul li a:hover {
	color: blue;
}

#login_div_1, #login_div_2, #login_div_3, #login_div_4 {
	padding: 20px;
}
#change_div_1, #change_div_2, #change_div_3, #change_div_4,#change_div_5 {
	padding: 20px;
}
.modal-content {
	margin-top: 250px;
}
</style>
</head>
<link rel="stylesheet" type="text/css"
	href="bootstrap/css/bootstrap.css" />
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
<script src="js/jquery.min.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="bootstrap/js/docs.min.js"></script>

<body>
	<div id="top" class="nav">
		<ul style="position: absolute;">
			<li><a hidefocus="true" class="navtitle" style="text-decoration: none;" onclick="sy()">首页</a></li>
			<li><a  class="navtitle">产品介绍</a></li>
			<li><a hidefocus="true" class="navtitle">软件下载</a></li>
			<li><a hidefocus="true" class="navtitle">前沿资讯</a></li>
			<li id="register_li"><a hidefocus="true" class="navtitle"  data-toggle="modal"
				data-target="#register">注册用户</a>
			</li>
			<li id="login_li"><a hidefocus="true" class="navtitle" data-toggle="modal"
				data-target="#login">登陆</a></li>
			<li id="change_mima_li" style="display: none"><a  data-toggle="modal" data-target="#change_mima">修改密码</a></li>
			<li id="tc" style="display: none"><a>退出登陆</a></li>
			<li id="userInfo" style="display: none"><span>欢迎您:&nbsp;&nbsp;&nbsp;</span><a id="user_a">${sessionScope.user.userName}</a></li>
		</ul>
		<div id="user_dd" style="display:none; margin-top: 0px;width: 100%;height:50px;line-height:50px; text-align: center;position: absolute;margin-top: 80px;background:#C8E5BC;">
			<button style=" width: 300px;font-size: 20px;" type="button" class="btn btn-success" onclick="wyxd()">我要下单</button>
			<button style=" width: 300px;font-size: 20px;margin-left:200px;" type="button" class="btn btn-success" onclick="wddd()">我的订单</button>
		</div>
	</div>
	<div id="middle" style="margin-top: 130px; overflow: auto;text-align: center;">
		<!-- <div id="banner" style="height: 100%;width: 90%;"></div> -->
		<img id="banner" alt="" src="" width="100%;" height="100%;">
		<%@ include file="../jsp/wyxd.jsp" %>
	<%@ include file="../jsp/wddd_manage.jsp" %>
	</div>
	<div class="wifi-bottom-wrap" id="footer">
		<ul>
			<li><a hidefocus="true" target="_blank">公司介绍</a>
			</li>
			<li><a hidefocus="true" target="_blank">售后服务支持</a>
			</li>
			<li><a hidefocus="true" target="_blank">系统更新日志</a>
			</li>
			<li><a hidefocus="true" target="_blank">常见问题</a>
			</li>
			<li><a hidefocus="true">投诉与建议</a></li>
		</ul>
	</div>
	<div class="modal fade" id="login" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title" id="change_title">登陆</h4>
				</div>
				<form id="login_form">
					<div class="modal-body" id="login_div">
						<div id="login_div_1" class="input-group">
							<span class="input-group-addon">用户名:</span> <input type="text"
								class="form-control" placeholder="请输入用户名"
								aria-describedby="basic-addon1" required="required"
								name="login_user_username">
						</div>
						<div id="login_div_2" class="input-group">
							<span class="input-group-addon">密码:&nbsp;&nbsp;&nbsp;</span> <input
								type="text" class="form-control" placeholder="请输入密码"
								aria-describedby="basic-addon1" required="required"
								name="login_user_password">
						</div>
						<div id="msg2">
							<span class="msg2_span1"></span>
							<span class="msg2_span2"></span>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						<button type="submit" class="btn btn-primary">登陆</button>
					</div>
				</form>
			</div>
		</div>
	</div>
	<!-- 修改密码Modal -->
	<div class="modal fade" id="change_mima" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title" id="change_title">修改信息</h4>
				</div>
				<form id="changge_form">
					<div class="modal-body" id="change_div">
						<div id="change_div_1" class="input-group">
							<span class="input-group-addon">用户名:</span> <input type="text"
								class="form-control" placeholder="请输入用户名"
								aria-describedby="basic-addon1" required="required"
								name="user_username" value="${sessionScope.user.userName}" disabled="disabled">
						</div>
						<div id="change_div_2" class="input-group">
							<span class="input-group-addon">密码:&nbsp;&nbsp;&nbsp;</span> <input
								type="text" class="form-control" placeholder="请输入密码"
								aria-describedby="basic-addon1" required="required"
								name="user_password">
						</div>
						<div id="change_div_3" class="input-group">
							<span class="input-group-addon">联系方式</span> <input type="text"
								class="form-control" placeholder="请输入手机号码"
								aria-describedby="basic-addon1" required="required" name="tel" value="${sessionScope.user.tel}">
						</div>
						<div id="change_div_4" class="input-group">
							<span class="input-group-addon">通讯地址</span> <input type="text"
								class="form-control" placeholder="请输入联系地址"
								aria-describedby="basic-addon1" required="required"
								name="address" value="${sessionScope.user.address}">
						</div>
						<div id="msg2">
							<span class="msg2_span1"></span>
							<span class="msg2_span2"></span>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						<button type="submit" class="btn btn-primary">修改</button>
					</div>
				</form>
			</div>
		</div>
		</div>
	<div class="modal fade" id="register" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title" id="change_title">注册用户</h4>
				</div>
				<form id="register_form">
					<div class="modal-body" id="login_div">
						<div id="login_div_1" class="input-group">
							<span class="input-group-addon">用户名:</span> <input type="text"
								class="form-control" placeholder="请输入用户名"
								aria-describedby="basic-addon1" required="required"
								name="register_user_username">
						</div>
						<div id="login_div_2" class="input-group">
							<span class="input-group-addon">密码:&nbsp;&nbsp;&nbsp;</span> <input
								type="text" class="form-control" placeholder="请输入密码"
								aria-describedby="basic-addon1" required="required"
								name="register_user_password">
						</div>
						<div id="login_div_2" class="input-group">
							<span class="input-group-addon">联系方式:&nbsp;&nbsp;&nbsp;</span> <input
								type="text" class="form-control" placeholder="请输入联系方式"
								aria-describedby="basic-addon1" required="required"
								name="register_user_fs">
						</div>
						<div id="login_div_2" class="input-group">
							<span class="input-group-addon">联系地址:&nbsp;&nbsp;&nbsp;</span> <input
								type="text" class="form-control" placeholder="请输入联系地址"
								aria-describedby="basic-addon1" required="required"
								name="register_user_address">
						</div>
						<div id="msg2">
							<span class="msg2_span1"></span>
							<span class="msg2_span2"></span>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						<button type="submit" class="btn btn-primary">注册</button>
					</div>
				</form>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
function wyxd(){
	$("#wyxd_div").show();
	$("#banner").hide();
	$("#wddd_manage_div").hide();
	wyxdQuery();
}
function sy(){
	$("#wyxd_div").hide();
	$("#banner").show();
	$("#wddd_manage_div").hide();
}
function wddd(){
	$("#wddd_manage_div").show();
	$("#wyxd_div").hide();
	$("#banner").hide();
	queryWddd();
}
$("#register_form").submit(function() {
	$(".msg2_span1").html("");
	$(".msg2_span2").html("");
	$.ajax({
		url : "user_register", //请求的url地址
		contentType : "application/json; charset=utf-8",
		dataType : "json", //返回格式为json
		type : "POST", //请求方式
		data : JSON.stringify({
			'userName' : $(
					"#register_form input[ name='register_user_username' ] ")
					.val(),
			'passWord' : $(
					"#register_form input[ name='register_user_password' ] ")
					.val(),
			'tel' : $("#register_form input[ name='register_user_fs' ] ").val(),
			'address' : $("#register_form input[ name='register_user_address' ] ")
					.val()
		}),
		beforeSend : function() {
		},
		success : function(data) {
			if (data.isSuccess) {
				$(".msg2_span1").html("注册成功...");
			} else {
				$(".msg2_span1").html("注册失败，该账户已经存在...");
			}
		},
		complete : function() {
			//请求完成的处理
			//alert("请求完成");
		},
		error : function(req) {
			alert("  error  请联系开发人员 ！");
		}
	});
	return false;
});
$("#tc").click(function() {
	$.ajax({
		url : "loyout", //请求的url地址
		contentType : "application/json; charset=utf-8",
		dataType : "json", //返回格式为json
		type : "POST",
		beforeSend : function() {
		},
		success : function(data) {
			window.location = "index";
		},
		complete : function() {
			//请求完成的处理
			//alert("请求完成");
		},
		error : function(req) {
			alert("  error  请联系开发人员 ！");
		}
	});
});
$("#changge_form").submit(function() {
	$(".msg2_span1").html("");
	$(".msg2_span2").html("");
	$.ajax({
		url : "change_mima", //请求的url地址
		contentType : "application/json; charset=utf-8",
		dataType : "json", //返回格式为json
		type : "POST", //请求方式
		data : JSON.stringify({
			'userName' : $(
					"#changge_form input[ name='user_username' ] ")
					.val(),
			'passWord' : $(
					"#changge_form input[ name='user_password' ] ")
					.val(),
			'tel' : $("#changge_form input[ name='tel' ] ").val(),
			'address' : $("#changge_form input[ name='address' ] ")
					.val(),
			'id':"${sessionScope.user.id}"
		}),
		beforeSend : function() {
		},
		success : function(data) {
			if (data.isSuccess) {
				$(".msg2_span1").html("修改成功...");
				window.location.href = "index";
			} else {
				$(".msg2_span1").html("修改失败...");
			}
		},
		complete : function() {
			//请求完成的处理
			//alert("请求完成");
		},
		error : function(req) {
			alert("  error  请联系开发人员 ！");
		}
	});
	return false;
});
$("#login_form").submit(function() {
	$(".msg2_span1").html("");
	$(".msg2_span2").html("");
	$.ajax({
		url : "login_to", //请求的url地址
		contentType : "application/json; charset=utf-8",
		dataType : "json", //返回格式为json
		type : "POST", //请求方式
		data : JSON.stringify({
			'userName' : $(
					"#login_form input[ name='login_user_username' ] ")
					.val(),
			'passWord' : $(
					"#login_form input[ name='login_user_password' ] ")
					.val()
		}),
		success : function(data) {
			console.log(data.view);
			if(data.isSuccess){
				window.location.href = data.view;
				if(data.view = "login"){
					$("#user_dd").show();
				}
			}else{
				$(".msg2_span1").html("用户名或者密码错误...");
			}
		},
		complete : function() {
			//请求完成的处理
			//alert("请求完成");
		},
		error : function(req) {
			alert( "  error  请联系开发人员 ！");
		}
	});
	return false;
});
	$(function() {
		var imgs = [ "img/1.jpg", "img/2.jpg", "img/3.jpg", "img/4.jpg",
				"img/5.jpg" ]; //（设定想要显示的图片）
		/* $("#banner").css("backgroundImage", "url(" + imgs[0] + ")"); */
		$("#banner").attr("src", imgs[0]);
		var i = 1;
		setInterval(function() {
			i++;
			var a = i % 5;
			console.log(a);
			/* $("#banner").css("backgroundImage", "url(" + imgs[a] + ")"); */
			$("#banner").attr("src", imgs[a]);
		}, 3000);
		$("#middle").css("height", $(window).height() - 220 + "px");
		$("#middle").css("width", $(window).width() -20  + "px");
		console.log("${sessionScope.user}");
		if("${sessionScope.user}" == ''){
			
		}else{
			$("#user_dd").show();
			$("#register_li").hide();
			$("#login_li").hide();
			$("#userInfo").show();
			$("#tc").show();
			$("#change_mima_li").show();
		}
	})
</script>

</html>